
Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/98203/1/47204/101102/66bc1ba4Fc6399b42/c920a3eff58bb2f7.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/149581/13/37779/8821/65ba1d01Fbdbe4ca6/f9cacb50eef3947a.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/170270/40/41708/35660/65ba1d00F00b7a93a/7c945140ae446518.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/107867/24/46319/30577/65ba1d00F5d1853d3/1ff3f2677afcd5d3.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/238222/2/12723/35521/65ba1d00F9b1ca85c/fdde7770de83b047.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img10.360buyimg.com/img/jfs/t1/245512/13/4188/32815/65ba1d73Fdf020639/a69fefcb673bcfee.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/224601/36/13554/94399/65ba1d72F054619f3/d7d1050968b56721.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/247886/7/4149/57182/65ba1d72Fa2066637/1761dc3034e48465.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/243124/38/3120/40255/65ba1d72F743fbf16/3aae78bd03a78899.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/235325/38/12260/51696/65ba1d71F1225197e/5813fa9e4a67364d.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/228804/26/13200/50637/65ba1d71Fc62c7bc2/de956da2e5493a78.jpg",

    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})